<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>订单</title>
</head>
<script src="../static/global.js"></script>
<body>

<!-- 查询订单-->
<div style="margin-top: 20px">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">订单编号</label>
                <div class="layui-input-inline">
                    <input type="text" name="order_sn_sousuo" id="order_sn_sousuo" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <button type="submit" class="layui-btn" id="order_souso" lay-submit="" lay-filter="demo1">查询</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>

<!--表格渲染-->
<table class="layui-hide" id="demo" lay-filter="test"></table>

<script>
    layui.use(['form','table','layer'],function (){
        let form = layui.form;
        let table = layui.table;
        let layer = layui.layer;
        let $ = layui.$;

        table.render({
            elem:'#demo',
            url:glodate.serverZuul + 'order/find_Admin_All_Oms_Order', //数据接口
            toolbar:'#toolbarDemo', //开启工具栏
            page:true,//开启分页
            cols:[[
                {type:'checkbox',fixed:'left'},
                {field: 'order_sn', title: '订单编号'},
                {field: 'coupon_id', title: '使用的优惠券'},
                {field: 'create_time', title: '订单创建时间'},
                {field: 'member_username', title: '用户名'},
                {field: 'total_amount', title: '订单总额'},
                {field: 'pay_amount', title: '应付总额'},
                {field: 'freight_amount', title: '运费金额'},

                {field: 'promotion_amount', title: '促销优化金额'},
                {field: 'create_time', title: '订单创建时间'},
                {field: 'order_sn', title: '订单编号'},
                {field: 'coupon_id', title: '使用的优惠券'},
                {field: 'create_time', title: '订单创建时间'},
                {field: 'order_sn', title: '订单编号'},
                {field: 'coupon_id', title: '使用的优惠券'},
                {field: 'create_time', title: '订单创建时间'},
                {fixed: 'right', align: 'center', toolbar: '#barDemo'}
            ]],id:'tableID'
        })

        //模糊查询
        $("#order_souso").on('click', function () {
            active.reload();
            return false;
        });

        active = {
            reload: function () {
                table.reload('tableID', {
                    where: {
                        'order_sn': $("#order_sn_sousuo").val()
                    }, page: {
                        curr: 1
                    }
                })
            }
        }

        //提取的清除表单的方法  formId form表头的id值
        function formIdreset(formId) {
            // 重置清空
            $(formId)[0].reset();
            form.render();//必须写
        }

    });
</script>

</body>
</html>